import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import *


class WinForm(QWidget):
	def __init__(self, parent=None):
		super(WinForm, self).__init__(parent)
		self.setWindowTitle('水平布局管理例子')

		# 水平布局按照从左到右的顺序添加按钮控件

		hlayout = QHBoxLayout()
		hlayout.addWidget(QPushButton(str(1)), 0, Qt.AlignTop)
		hlayout.addWidget(QPushButton(str(2)), 0, Qt.AlignLeft | Qt.AlignTop)
		hlayout.addWidget(QPushButton(str(3)))
		hlayout.addWidget(QPushButton(str(4)), 0, Qt.AlignLeft | Qt.AlignBottom)
		hlayout.addWidget(QPushButton(str(5)), 0, Qt.AlignLeft | Qt.AlignBottom)

		self.setLayout(hlayout)


if __name__ == '__main__':
	app = QApplication(sys.argv)
	demo = WinForm()
	demo.show()
	sys.exit(app.exec_())
